<?php
require('includes/top.php');

$user_id = $_POST['user_id'];

$laptop_model = $_POST['laptop_model'];
$modelname_array = explode('-',$laptop_model);

$sql3 = mysql_query('SELECT laptop_id FROM `laptop_details` where laptop_model="'.$modelname_array[0].'" and serial_no="'.$modelname_array[1].'"');
$result3 = mysql_fetch_row($sql3);
echo 'lap'.$result3[0];


$sql = "UPDATE laptop SET `laptop_id` = '".$result3[0]."',`laptopmodel` = '".$modelname_array[0]."',`serial_no` = '".$modelname_array[1]."' where user_id='".trim($user_id)."'";
$result=mysql_query($sql);


if($result>0)
{
header('Location: user_laptop_details.php?v=success');
}
else
{
header('Location: user_laptop_details.php?v=err');
}
?>